package com.company.cloud.tenant.modules.app.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.company.cloud.common.asserts.ValidatorUtils;
import com.company.cloud.common.auth.annotation.Login;
import com.company.cloud.common.bean.BaseResult;
import com.company.cloud.common.bean.IdStrParam;
import com.company.cloud.tenant.modules.api.request.TenantQueryRequest;
import com.company.cloud.tenant.modules.api.response.TenantFull;
import com.company.cloud.tenant.modules.app.controller.req.TenantApplyParam;
import com.company.cloud.tenant.modules.app.controller.req.TenantEditParam;
import com.company.cloud.tenant.modules.app.controller.req.TenantQuery4PageParam;
import com.company.cloud.tenant.modules.app.controller.req.TenantSendVCodeParam;
import com.company.cloud.tenant.modules.cache.service.TenantCacheService;
import com.company.cloud.tenant.modules.mgr.service.TenantMgrService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Log4j2
@RestController
@RequestMapping("/app/t/tenant")
@Api(tags="TenantApp_租户服务")
public class TenantAppController {

    @Autowired
    private TenantMgrService tenantMgrService;
    @Autowired
    private TenantCacheService tenantCacheService;




    @PostMapping("/sendVCode")
    @ApiOperation(value="发送验证码", response= BaseResult.class)
    public BaseResult sendVCode(@RequestBody TenantSendVCodeParam params) {
        return BaseResult.ok();
    }


    @PostMapping("/apply")
    @ApiOperation(value="申请租户", response= BaseResult.class)
    public BaseResult apply(@RequestBody TenantApplyParam params) {
        return BaseResult.ok();
    }


    @Login
    @PostMapping("/info")
    @ApiOperation(value="租户信息获取", response= TenantFull.class)
    public BaseResult info() {
//        TenantFull data= tenantMgrService.info(params.getId());
        return BaseResult.ok();
    }

    @Login
    @PostMapping("/edit")
    @ApiOperation(value="租户信息修改", response= TenantFull.class)
    public BaseResult edit(@RequestBody TenantEditParam params) {
//        TenantFull data= tenantMgrService.info(params.getId());
        return BaseResult.ok();
    }










//    @Deprecated
//    @PostMapping("/query")
//    @ApiOperation(value="租户查询", response= TenantFull.class)
//    public BaseResult query(@RequestBody TenantQuery4PageParam params) {
//        TenantQueryRequest request=new TenantQueryRequest();
//        request.setCompanyNo(params.getCompanyNo());
//        request.setName(params.getName());
//        request.setType(params.getType());
//        request.setSourceType(params.getSourceType());
//        request.setSource(params.getSource());
//        request.setPage(params.getPage());
//        request.setRows(params.getRows());
//        IPage<TenantFull> data= tenantMgrService.query(request);
//        return BaseResult.ok(data);
//    }


//
////    @Login
////    @PostMapping("/add")
////    @ApiOperation(value="公司新增", response= BaseResult.class)
////    public BaseResult add(@RequestBody CompanyAddRequest params) {
////        ValidatorUtils.validate(params);
////        LoginSimpleUserInfo userInfo = AuthContextUtils.getUser();
////        companyMgrService.save(params,userInfo);
////        return BaseResult.ok();
////    }
////
////    @Login
////    @PostMapping("/edit")
////    @ApiOperation(value="公司修改", response= BaseResult.class)
////    public BaseResult edit(@RequestBody CompanyUpdateRequest params) {
////        ValidatorUtils.validate(params);
////        LoginSimpleUserInfo userInfo = AuthContextUtils.getUser();
////        companyMgrService.update(params,userInfo);
////        return BaseResult.ok();
////    }
//






}
